home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9044 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: isonews.bbn.hp.com!hpbblb!news
  2. From: Matthias Dittrich <matti>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: [HLP] Easy Problem w/ Classes!
  5. Date: 26 Feb 1996 16:56:31 GMT
  6. Organization: Hewlett-Packard Co.
  7. Message-ID: <4gsonv$p1c@hpbblb.bbn.hp.com>
  8. References: <4gfn3v$jp@news.umbc.edu>
  9. NNTP-Posting-Host: trabant.bbn.hp.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.07 9000/712)
  14. X-URL: news:4gfn3v$jp@news.umbc.edu
  15.  
  16. ssopre1@umbc.edu (Sunil ) wrote:
  17. >Hello all
  18. >  Heres a little problem that I need help with. 
  19. >
  20. >// Point.h contains
  21. >Class Point {
  22. >private: int x;
  23. >     int y;
  24. >
  25. >public: Point()
  26. /* initialize private members here */
  27.  {
  28.    x=0;
  29.    y=0;
  30.  }
  31.  
  32. >}
  33. > ...
  34.  
  35. > ...
  36. >// LineSeg.C contains
  37. >LineSeg::LineSeg()
  38. >{
  39.  
  40. delete the following four lines:
  41. > Point.end.x=0;  // Are these valid? 
  42. > Point.end.y=0;  // What do I need to add/del here? 
  43. > Point.start.x=0;
  44. > Point.start.y=0;
  45.  
  46. >}
  47. > ...
  48. x and y are private members of Point, so you can't set them from outside
  49. class Point. Use the Point-constructor to do it.
  50.  
  51. Good luck,
  52. Matthias
  53.  
  54.